package aygx.Configuration.yml.controller;

import aygx.Configuration.yml.config.YmlConfig;
import aygx.Configuration.yml.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 暗影孤星
 * @date 2020/10/24 23:37
 * @explanation
 */
@RestController
@RequestMapping("yml")
public class YmlController {
    @Autowired
    private YmlConfig ymlConfig;
    @Autowired
    private Environment environment;
    @Autowired
    private Person person;

    @GetMapping
    public void yml() {
        System.out.println(ymlConfig.toString());
        System.out.println(environment.toString());
        System.out.println(environment.getProperty("my.persons"));
        System.out.println(environment.getProperty("my.persons"));
        System.out.println(environment.getProperty("my.persons[0]"));
        System.out.println(environment.getProperty("my.persons[0].name"));
        System.out.println(person);
    }
}
